Optimal. Leaf size=154 \[ \frac {x}{b^2}-\frac {2 \left (a^4+a^2 b^2-2 b^4\right ) \tan ^{-1}\left (\frac {b+a \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a^2-b^2}}\right )}{a^3 b^2 \sqrt {a^2-b^2} d}+\frac {2 b \tanh ^{-1}(\cos (c+d x))}{a^3 d}+\frac {\left (a^2-2 b^2\right ) \cos (c+d x)}{a^2 b d (a+b \sin (c+d x))}-\frac {\cot (c+d x)}{a d (a+b \sin (c+d x))} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.18, antiderivative size = 154, normalized size of antiderivative = 1.00, number of steps
used = 6, number of rules used = 6, integrand size = 29, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.207, Rules used = {2969, 3136,
2739, 632, 210, 3855} \begin {gather*} \frac {2 b \tanh ^{-1}(\cos (c+d x))}{a^3 d}+\frac {\left (a^2-2 b^2\right ) \cos (c+d x)}{a^2 b d (a+b \sin (c+d x))}-\frac {2 \left (a^4+a^2 b^2-2 b^4\right ) \text {ArcTan}\left (\frac {a \tan \left (\frac {1}{2} (c+d x)\right )+b}{\sqrt {a^2-b^2}}\right )}{a^3 b^2 d \sqrt {a^2-b^2}}-\frac {\cot (c+d x)}{a d (a+b \sin (c+d x))}+\frac {x}{b^2} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 210
Rule 632
Rule 2739
Rule 2969
Rule 3136
Rule 3855
Rubi steps
\begin {align*} \int \frac {\cos ^2(c+d x) \cot ^2(c+d x)}{(a+b \sin (c+d x))^2} \, dx &=\frac {\left (a^2-2 b^2\right ) \cos (c+d x)}{a^2 b d (a+b \sin (c+d x))}-\frac {\cot (c+d x)}{a d (a+b \sin (c+d x))}+\frac {\int \frac {\csc (c+d x) \left (-2 b^2-a b \sin (c+d x)+a^2 \sin ^2(c+d x)\right )}{a+b \sin (c+d x)} \, dx}{a^2 b}\\ &=\frac {x}{b^2}+\frac {\left (a^2-2 b^2\right ) \cos (c+d x)}{a^2 b d (a+b \sin (c+d x))}-\frac {\cot (c+d x)}{a d (a+b \sin (c+d x))}-\frac {(2 b) \int \csc (c+d x) \, dx}{a^3}-\frac {\left (a^4+a^2 b^2-2 b^4\right ) \int \frac {1}{a+b \sin (c+d x)} \, dx}{a^3 b^2}\\ &=\frac {x}{b^2}+\frac {2 b \tanh ^{-1}(\cos (c+d x))}{a^3 d}+\frac {\left (a^2-2 b^2\right ) \cos (c+d x)}{a^2 b d (a+b \sin (c+d x))}-\frac {\cot (c+d x)}{a d (a+b \sin (c+d x))}-\frac {\left (2 \left (a^4+a^2 b^2-2 b^4\right )\right ) \text {Subst}\left (\int \frac {1}{a+2 b x+a x^2} \, dx,x,\tan \left (\frac {1}{2} (c+d x)\right )\right )}{a^3 b^2 d}\\ &=\frac {x}{b^2}+\frac {2 b \tanh ^{-1}(\cos (c+d x))}{a^3 d}+\frac {\left (a^2-2 b^2\right ) \cos (c+d x)}{a^2 b d (a+b \sin (c+d x))}-\frac {\cot (c+d x)}{a d (a+b \sin (c+d x))}+\frac {\left (4 \left (a^4+a^2 b^2-2 b^4\right )\right ) \text {Subst}\left (\int \frac {1}{-4 \left (a^2-b^2\right )-x^2} \, dx,x,2 b+2 a \tan \left (\frac {1}{2} (c+d x)\right )\right )}{a^3 b^2 d}\\ &=\frac {x}{b^2}-\frac {2 \left (a^4+a^2 b^2-2 b^4\right ) \tan ^{-1}\left (\frac {b+a \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a^2-b^2}}\right )}{a^3 b^2 \sqrt {a^2-b^2} d}+\frac {2 b \tanh ^{-1}(\cos (c+d x))}{a^3 d}+\frac {\left (a^2-2 b^2\right ) \cos (c+d x)}{a^2 b d (a+b \sin (c+d x))}-\frac {\cot (c+d x)}{a d (a+b \sin (c+d x))}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 1.27, size = 182, normalized size = 1.18 \begin {gather*} \frac {\frac {2 (c+d x)}{b^2}-\frac {4 \left (a^4+a^2 b^2-2 b^4\right ) \tan ^{-1}\left (\frac {b+a \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a^2-b^2}}\right )}{a^3 b^2 \sqrt {a^2-b^2}}-\frac {\cot \left (\frac {1}{2} (c+d x)\right )}{a^2}+\frac {4 b \log \left (\cos \left (\frac {1}{2} (c+d x)\right )\right )}{a^3}-\frac {4 b \log \left (\sin \left (\frac {1}{2} (c+d x)\right )\right )}{a^3}+\frac {2 \left (a^2-b^2\right ) \cos (c+d x)}{a^2 b (a+b \sin (c+d x))}+\frac {\tan \left (\frac {1}{2} (c+d x)\right )}{a^2}}{2 d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.53, size = 201, normalized size = 1.31
method | result | size |
derivativedivides | \(\frac {\frac {\tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{2 a^{2}}+\frac {2 \arctan \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{b^{2}}-\frac {1}{2 a^{2} \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}-\frac {2 b \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{a^{3}}-\frac {2 \left (\frac {-b^{2} \left (a^{2}-b^{2}\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )-b a \left (a^{2}-b^{2}\right )}{a \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+2 b \tan \left (\frac {d x}{2}+\frac {c}{2}\right )+a}+\frac {\left (a^{4}+a^{2} b^{2}-2 b^{4}\right ) \arctan \left (\frac {2 a \tan \left (\frac {d x}{2}+\frac {c}{2}\right )+2 b}{2 \sqrt {a^{2}-b^{2}}}\right )}{\sqrt {a^{2}-b^{2}}}\right )}{a^{3} b^{2}}}{d}\) | \(201\) |
default | \(\frac {\frac {\tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{2 a^{2}}+\frac {2 \arctan \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{b^{2}}-\frac {1}{2 a^{2} \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}-\frac {2 b \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{a^{3}}-\frac {2 \left (\frac {-b^{2} \left (a^{2}-b^{2}\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )-b a \left (a^{2}-b^{2}\right )}{a \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+2 b \tan \left (\frac {d x}{2}+\frac {c}{2}\right )+a}+\frac {\left (a^{4}+a^{2} b^{2}-2 b^{4}\right ) \arctan \left (\frac {2 a \tan \left (\frac {d x}{2}+\frac {c}{2}\right )+2 b}{2 \sqrt {a^{2}-b^{2}}}\right )}{\sqrt {a^{2}-b^{2}}}\right )}{a^{3} b^{2}}}{d}\) | \(201\) |
risch | \(\frac {x}{b^{2}}-\frac {2 i \left (3 a \,b^{2} {\mathrm e}^{i \left (d x +c \right )}-2 i b^{3} {\mathrm e}^{2 i \left (d x +c \right )}+2 i b^{3}+i a^{2} b \,{\mathrm e}^{2 i \left (d x +c \right )}+{\mathrm e}^{3 i \left (d x +c \right )} a^{3}-a \,b^{2} {\mathrm e}^{3 i \left (d x +c \right )}-i a^{2} b -a^{3} {\mathrm e}^{i \left (d x +c \right )}\right )}{\left ({\mathrm e}^{2 i \left (d x +c \right )}-1\right ) b^{2} \left (-i b \,{\mathrm e}^{2 i \left (d x +c \right )}+i b +2 a \,{\mathrm e}^{i \left (d x +c \right )}\right ) a^{2} d}-\frac {2 b \ln \left ({\mathrm e}^{i \left (d x +c \right )}-1\right )}{a^{3} d}-\frac {\sqrt {-a^{2}+b^{2}}\, \ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {i a +\sqrt {-a^{2}+b^{2}}}{b}\right )}{d \,b^{2} a}-\frac {2 \sqrt {-a^{2}+b^{2}}\, \ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {i a +\sqrt {-a^{2}+b^{2}}}{b}\right )}{d \,a^{3}}+\frac {\sqrt {-a^{2}+b^{2}}\, \ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {i a -\sqrt {-a^{2}+b^{2}}}{b}\right )}{d \,b^{2} a}+\frac {2 \sqrt {-a^{2}+b^{2}}\, \ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {i a -\sqrt {-a^{2}+b^{2}}}{b}\right )}{d \,a^{3}}+\frac {2 b \ln \left ({\mathrm e}^{i \left (d x +c \right )}+1\right )}{a^{3} d}\) | \(417\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [F(-2)]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Exception raised: ValueError} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 0.46, size = 675, normalized size = 4.38 \begin {gather*} \left [\frac {2 \, a^{3} b d x \cos \left (d x + c\right )^{2} - 2 \, a^{3} b d x + 2 \, a^{2} b^{2} \cos \left (d x + c\right ) - {\left (a^{2} b + 2 \, b^{3} - {\left (a^{2} b + 2 \, b^{3}\right )} \cos \left (d x + c\right )^{2} + {\left (a^{3} + 2 \, a b^{2}\right )} \sin \left (d x + c\right )\right )} \sqrt {-a^{2} + b^{2}} \log \left (\frac {{\left (2 \, a^{2} - b^{2}\right )} \cos \left (d x + c\right )^{2} - 2 \, a b \sin \left (d x + c\right ) - a^{2} - b^{2} + 2 \, {\left (a \cos \left (d x + c\right ) \sin \left (d x + c\right ) + b \cos \left (d x + c\right )\right )} \sqrt {-a^{2} + b^{2}}}{b^{2} \cos \left (d x + c\right )^{2} - 2 \, a b \sin \left (d x + c\right ) - a^{2} - b^{2}}\right ) + 2 \, {\left (b^{4} \cos \left (d x + c\right )^{2} - a b^{3} \sin \left (d x + c\right ) - b^{4}\right )} \log \left (\frac {1}{2} \, \cos \left (d x + c\right ) + \frac {1}{2}\right ) - 2 \, {\left (b^{4} \cos \left (d x + c\right )^{2} - a b^{3} \sin \left (d x + c\right ) - b^{4}\right )} \log \left (-\frac {1}{2} \, \cos \left (d x + c\right ) + \frac {1}{2}\right ) - 2 \, {\left (a^{4} d x + {\left (a^{3} b - 2 \, a b^{3}\right )} \cos \left (d x + c\right )\right )} \sin \left (d x + c\right )}{2 \, {\left (a^{3} b^{3} d \cos \left (d x + c\right )^{2} - a^{4} b^{2} d \sin \left (d x + c\right ) - a^{3} b^{3} d\right )}}, \frac {a^{3} b d x \cos \left (d x + c\right )^{2} - a^{3} b d x + a^{2} b^{2} \cos \left (d x + c\right ) - {\left (a^{2} b + 2 \, b^{3} - {\left (a^{2} b + 2 \, b^{3}\right )} \cos \left (d x + c\right )^{2} + {\left (a^{3} + 2 \, a b^{2}\right )} \sin \left (d x + c\right )\right )} \sqrt {a^{2} - b^{2}} \arctan \left (-\frac {a \sin \left (d x + c\right ) + b}{\sqrt {a^{2} - b^{2}} \cos \left (d x + c\right )}\right ) + {\left (b^{4} \cos \left (d x + c\right )^{2} - a b^{3} \sin \left (d x + c\right ) - b^{4}\right )} \log \left (\frac {1}{2} \, \cos \left (d x + c\right ) + \frac {1}{2}\right ) - {\left (b^{4} \cos \left (d x + c\right )^{2} - a b^{3} \sin \left (d x + c\right ) - b^{4}\right )} \log \left (-\frac {1}{2} \, \cos \left (d x + c\right ) + \frac {1}{2}\right ) - {\left (a^{4} d x + {\left (a^{3} b - 2 \, a b^{3}\right )} \cos \left (d x + c\right )\right )} \sin \left (d x + c\right )}{a^{3} b^{3} d \cos \left (d x + c\right )^{2} - a^{4} b^{2} d \sin \left (d x + c\right ) - a^{3} b^{3} d}\right ] \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \frac {\cos ^{4}{\left (c + d x \right )} \csc ^{2}{\left (c + d x \right )}}{\left (a + b \sin {\left (c + d x \right )}\right )^{2}}\, dx \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 0.47, size = 260, normalized size = 1.69 \begin {gather*} \frac {\frac {6 \, {\left (d x + c\right )}}{b^{2}} - \frac {12 \, b \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) \right |}\right )}{a^{3}} + \frac {3 \, \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{a^{2}} - \frac {12 \, {\left (a^{4} + a^{2} b^{2} - 2 \, b^{4}\right )} {\left (\pi \left \lfloor \frac {d x + c}{2 \, \pi } + \frac {1}{2} \right \rfloor \mathrm {sgn}\left (a\right ) + \arctan \left (\frac {a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + b}{\sqrt {a^{2} - b^{2}}}\right )\right )}}{\sqrt {a^{2} - b^{2}} a^{3} b^{2}} + \frac {4 \, a b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 9 \, a^{2} b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 4 \, b^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 12 \, a^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 14 \, a b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 3 \, a^{2} b}{{\left (a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 2 \, b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )\right )} a^{3} b}}{6 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 12.09, size = 2500, normalized size = 16.23 \begin {gather*} \text {Too large to display} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________